package com.deepcode.StringProcess;


import com.deepcode.StringProcess.strategy.impl.PreviousAlphabetCharacterStrategy;
import com.deepcode.StringProcess.strategy.impl.PreviousLocationCharacterStrategy;
import com.deepcode.StringProcess.strategy.impl.RemoveCharacterStrategy;
import com.deepcode.StringProcess.template.impl.ApplyStrategyProcessor;

/**
 * 测试类
 */
public class Main {
    static final String CASE_1="aabcccbbad";
    static final String CASE_2="abcccbad";
    static final String CASE_3="aaabbbccc";
    static final String CASE_4="abccbad";
    public static void main(String[] args) {
        testRemoveCharacterStrategy();
        testPreviousAlphabetCharacterStrategy();
        testPreviousLocationCharacterStrategy();
    }

    public static void testPreviousLocationCharacterStrategy() {
        ApplyStrategyProcessor processor = new ApplyStrategyProcessor(new PreviousLocationCharacterStrategy());
        // 测试用例
        printProcess(CASE_1,processor);
        printProcess(CASE_2,processor);
        printProcess(CASE_3,processor);
        printProcess(CASE_4,processor);
    }

    public static void testPreviousAlphabetCharacterStrategy() {
        ApplyStrategyProcessor processor = new ApplyStrategyProcessor(new PreviousAlphabetCharacterStrategy());

        // 测试用例
        printProcess(CASE_1,processor);
        printProcess(CASE_2,processor);
        printProcess(CASE_3,processor);
        printProcess(CASE_4,processor);
    }

    public static void testRemoveCharacterStrategy() {
        ApplyStrategyProcessor processor = new ApplyStrategyProcessor(new RemoveCharacterStrategy());

        // 测试用例
        printProcess(CASE_1,processor);
        printProcess(CASE_2,processor);
        printProcess(CASE_3,processor);
        printProcess(CASE_4,processor);
    }

    private static void printProcess(String testString, ApplyStrategyProcessor processor) {
        System.out.println(testString);
        System.out.println(processor.processString(testString));
        System.out.println();
    }
}